/* 
 * File:   SearchCriteria.hpp
 * Author: Faisal
 *
 * Created on April 27, 2012, 8:39 PM
 *
 * Description:
 *		This is a base class that will be implemented by the Business objects to provide them the "Select" feature that will call the Query Modifier and 
 *		create the filters. It's a templated class that has Query Modifier type and the specific business object.
 *
 */

#ifndef HSearchCriteria_Common

#define HSearchCriteria_Common

#include "Shared.hpp"

namespace Supetronix
{
	namespace PersistO
	{
		namespace Common
		{
			template<class qm, class bo>
			class SearchCriteria
			{
			public:
				/*
				*	Methods
				*/

				//this method will be used by the generated business objects so we are not passing any query to Query Modifier and when query modifier will
				//call the business object execute then it can use internal "cached" query
				static std::unique_ptr<qm> Select(void)
				{
					return Select("");
				}

				//this method will be used by the users for "GenericBusinessObject" or "generated business object" when they want to execute a different query than
				//the internal query of the generated business object
				static std::unique_ptr<qm> Select(const std::string& query)
				{
					return std::unique_ptr<qm>(new qm(new bo(), query));
				}

			};
		}
	}
}

#endif